package com.tc.dispatch.csservice.util;

import com.tc.dispatch.csservice.dao.*;
import com.tc.dispatch.csservice.exception.*;

import com.tc.dispatch.csservice.dao.mssql.MaoPiServiceDAO;
import com.tc.dispatch.csservice.algorithm.calculation.Calclation;

public class DAOFactory {
  public DAOFactory() {
  }



  public static MaoPiServiceDAO getMaoPiServiceDAO() throws CSSysException {
    try {
      ServiceLocator sl = new ServiceLocator();
      String CSServiceDAOClassName = sl.getString(JNDINames.MAOPI_DAO_CLASS);
      return (MaoPiServiceDAO) Class.forName(CSServiceDAOClassName).newInstance();
    }
    catch (Exception ex) {
      throw new CSSysException();
    }
  }

  public static ManuCostDAO getManuCostDAO() throws CSSysException {
    try {
      ServiceLocator sl = new ServiceLocator();
      String CSServiceDAOClassName = sl.getString(JNDINames.MANU_COST_DAO_CLASS);
      return (ManuCostDAO) Class.forName(CSServiceDAOClassName).newInstance();
    }
    catch (Exception ex) {
      throw new CSSysException();
    }
  }

  public static ProcsDetailDAO getProcsDetailDAO() throws CSSysException {
      try {
	ServiceLocator sl = new ServiceLocator();
	String CSServiceDAOClassName = sl.getString(JNDINames.PROCS_DETAIL_DAO_CLASS);
	return (ProcsDetailDAO) Class.forName(CSServiceDAOClassName).newInstance();
      }
      catch (Exception ex) {
	throw new CSSysException();
      }
    }
    public static TrainDAO getTrainDAO() throws CSSysException {
      try {
	ServiceLocator sl = new ServiceLocator();
	String CSServiceDAOClassName = sl.getString(JNDINames.TRAIN_DAO_CLASS);
	return (TrainDAO) Class.forName(CSServiceDAOClassName).newInstance();
      }
      catch (Exception ex) {
	throw new CSSysException();
      }
    }





}